import { Villager } from 'libs/db/entity/villager.entity';
import { LocalForWebStrategy } from './local-web.strategy';
import { JwtForWebStrategy } from './jwt-web.strategy';
import { Module } from '@nestjs/common';
import { AuthService } from './auth.service';
import { PassportModule } from '@nestjs/passport';
import { LocalStrategy } from './local-admin.strategy';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from 'libs/db/entity/user.entity';
import { JwtModule } from '@nestjs/jwt';
import { jwtConstants } from './constants';
import { JwtStrategy } from './jwt-admin.strategy';

@Module({
  imports: [
    TypeOrmModule.forFeature([User, Villager]),
    PassportModule,
    JwtModule.registerAsync({
      useFactory() {
        return {
          secret: jwtConstants.secret,
          signOptions: { expiresIn: '7d' },
        };
      },
    }),
  ],
  providers: [AuthService, LocalStrategy, LocalForWebStrategy, JwtStrategy, JwtForWebStrategy, ],
  exports: [AuthService],
})
export class AuthModule {}
